package com.manor.paradise.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.Lifecycle
import androidx.viewpager2.adapter.FragmentStateAdapter

/**


 * @date  2020/7/8  14:34
 * @version 1.0
 */
public class VP2Adapter : FragmentStateAdapter {
    private var fragmentList: MutableList<Fragment>

    constructor(fragment: Fragment, fList: MutableList<Fragment>) : super(fragment) {
        this.fragmentList = fList
    }

    constructor(fragment: FragmentActivity, fList: MutableList<Fragment>) : super(fragment) {
        this.fragmentList = fList
    }

    constructor(fragment: FragmentManager, lifecycle: Lifecycle, fList: MutableList<Fragment>) : super(fragment, lifecycle) {
        this.fragmentList = fList
    }



    override fun getItemCount(): Int = fragmentList.size

    override fun createFragment(position: Int): Fragment = fragmentList[position]


}